// index.js
// 获取应用实例
Page({
  data: {
    whname: "仓库名称",
    whid: 0,
  },
  dialog() {
    wx.showToast({
      title: '请先登录仓库',
      icon: 'error',
    })
    setTimeout(function () {
      wx.hideToast()
      wx.reLaunch({
        url: '../mine/mine',
      })
    }, 1000)
  },
  cha: function () {
    if (this.data.whid != 0) {
      wx.navigateTo({
        url: '../chazhao/chazhao',
      })
    } else {
      this.dialog()
    }

  },
  ru: function () {
    if (this.data.whid != 0) {
      wx.navigateTo({
        url: '../ruku/ruku',
      })
    } else {
      this.dialog()
    }

  },
  chu: function () {
    if (this.data.whid != 0) {
      wx.navigateTo({
        url: '../chuku/chuku',
      })
    } else {
      this.dialog()
    }

  },
  xiu: function () {
    if (this.data.whid != 0) {
      wx.navigateTo({
        url: '../xiugai/xiugai',
      })
    } else {
      this.dialog()
    }
    
  },
  onLoad: function (options) {
    let whid = wx.getStorageSync('warehouseId');
    let whname = wx.getStorageSync('whName');
    // console.log(whname)
    if (whid) {
      this.setData({
        whid,
      })
    }
    if (whname) {
      this.setData({
        whname,
      })
    }
  },

})
